package com.itheima.mytest;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.ArrayList;

public class Test4 {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        //创建反序列化对象
        ObjectInputStream ois=new ObjectInputStream(new FileInputStream("myio\\a.txt"));

        //进行数据的读取
        ArrayList<Student>list= (ArrayList<Student>) ois.readObject();

        for (Student student : list) {
            System.out.println(student);
        }

        //关流
        ois.close();
    }
}
